<?php
session_start();
//$_SESSION["cart"];
$product_id = "";
if(isset($_POST["product_id"])){
	$product_id = $_POST["product_id"];
}

if(isset($_SESSION["cart"][$product_id])){
	$num_product = $_SESSION["cart"][$product_id]+1;
}else {
	$num_product = 1;
}

$_SESSION['cart'][$product_id] = $num_product;
echo count($_SESSION['cart']);